<?php
namespace app\api\controller\com;
class Slide extends Base {
	//列表
	public function lists() {
		$d = $this->post;
		$rule = [
			//'keyword'=>'require',
			'page' => 'require|integer',
			'limit' => 'require|integer',
		];
		$msg = [];
		check($rule, $msg, $d);
		$map = [];
		if ($d['cat_id'] != '') {
			$map[] = ['and', 'cat_id', '=', $d['cat_id']];
		}
		if ($d['keyword'] != '') {
			$map[] = ['and', 'title', 'like', "%{$d['keyword']}%"];
		}
		$w = where($map);
		$rs = $this->db->query("select * from slide $w[0] order by sort desc,id desc" . limit($d['page'], $d['limit']), $w[1]);
		if ($rs) {
			suc($rs);
		}
		suc([], 0);
	}
}
